import sys
class Solution(object):
    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """

        # a =  len(nums)
        # cur_num = max_num = nums[0]
        # for i in range(1,a):
        #     cur_num = max(nums[i]+cur_num,nums[i])
        #     max_num = max(cur_num,max_num)
        # return max_num

        a = len(nums)
        f = [0] * (a)
        f[0] = nums[0]
        for i in range(1, a):
            f[i] = max(nums[i] + f[i-1], nums[i])

        return max(f)


a = [-2]
s =Solution()
m = s.maxSubArray(a)
print(m)